function CookieSettings() {
    this.writeCookie = function (name, value, days) {
        let date, expires;

        if (days) {
            date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toGMTString();
        }
        else {
            expires = "";
        }

        document.cookie = name + "=" + value + expires + "; path=/";
    }

    this.readCookie = function (name) {
        let i, c, ca, nameEQ = name + "=";

        ca = document.cookie.split(';');

        for (i = 0; i < ca.length; i++) {
            c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1, c.length);
            }
            if (c.indexOf(nameEQ) == 0) {
                return c.substring(nameEQ.length, c.length);
            }
        }

        return '';
    }

    this.getUserName = function () {
        let ckstr = this.readCookie("loginstatus");
        let username = "";

        let p = ckstr.indexOf("|");

        if (p < 0)
            return "";
        else {
            username = ckstr.substring(2);

            if (username.length >= 5)
                return username;
            else
                return "";
        }
    }

    this.getUrlVars = function () {
        var vars = {};
        var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
            vars[key] = value;
        });
        return vars;
    }
}